package com.cgx.tablet.beeper.presenter;

import com.cgx.tablet.beeper.api.ApiCallback;
import com.cgx.tablet.beeper.api.ApiUtil;
import com.cgx.tablet.beeper.base.BasePresenter;
import com.cgx.tablet.beeper.bean.CallBean;
import com.cgx.tablet.beeper.bean.SpecialCallBean;
import com.cgx.tablet.beeper.bean.response.InfoResponse;
import com.cgx.tablet.beeper.bean.response.ListResponse;
import com.cgx.tablet.beeper.view.ISpecialCallView;

/**
 * Created by Administrator on 2018/9/14 0014.
 */

public class SpecialCallPresenter extends BasePresenter{

    private ISpecialCallView view;
    public SpecialCallPresenter(ISpecialCallView view) {
        super(view);
        this.view = view;
    }

    public void getSpecialCall(String ticket) {
        callApi(ApiUtil.apiService.getSpecialCall(ticket), new ApiCallback<ListResponse<SpecialCallBean>>() {
            @Override
            public void onSuccess(final ListResponse<SpecialCallBean> response) {
                view.getSpecialCallSuccess(response.getData());
            }

            @Override
            public void onFail(String code, String msg) {
                view.getSpecialCallFail(code, msg);
            }
        });
    }

    public void specialCall(String tid) {
        callApi(ApiUtil.apiService.specialCall(tid), new ApiCallback<InfoResponse<CallBean>>() {
            @Override
            public void onSuccess(final InfoResponse<CallBean> response) {
                view.specialCallSuccess(response.getInfo());
            }

            @Override
            public void onFail(String code, String msg) {
                view.specialCallFail(code, msg);
            }
        });
    }
}
